import apiService from '../http/request'

enum infoApi {
    GET_INFO = '/react/info',
    GET_captcha = '/users/captcha',
    POST_login = '/users/login',
}
export const getInfoApi = (data) => {
    return apiService.get(infoApi.GET_INFO, data)
}
// 获取验证码
export const getCaptchaApi = () => {
    return apiService.get(
        infoApi.GET_captcha,
        {},
        {
            headers: { 'X-Skip-Auth': 'true' },
        }
    )
}
// 登录
export const toLoginApi = (data: loginParams) => {
    return apiService.post(infoApi.POST_login, data, {
        withCredentials: true,
    })
}

type loginParams = {
    username: string
    password: string
    captcha: string
}
